/**
 * 获取订单信息
 * @param id
 */
function getAjaxOrders(id) {
		var tempString = "";
		$("#modalBodyOrders").html(tempString);
		$.ajax({
			type : 'post',
			url : path+'/ediOrderSource/detailed',
			data : 'id=' + id,
			dataType : 'json',
			success : function(data) {
				if (data.status == "1") {
					tempString += "<tr><th>订单编号</th><td>"+ data.content.ordeno + "</td></tr>"
					        +"<tr><th>商家订单号</th><td>"+ data.content.customerOrdeno + "</td></tr>"
					        +"<tr><th>来源单号</th><td>"+ data.content.fromno + "</td></tr>"
					        +"<tr><th>能容运单号</th><td>"+ data.content.waybillNo + "</td></tr>"
							+ "<tr><th>收货人详细地址</th><td>"+ data.content.addres + "</td></tr>"
							+ "<tr><th>省</th>" + "<td>" + data.content.provna
							+ "</td></tr>" + "<tr><th>市</th>" + "<td>"
							+ data.content.cityna + "</td></tr>"
							+ "<tr><th>区</th>" + "<td>" + data.content.distna
							+ "</td></tr>" + "<tr><th>邮编</th>" + "<td>"
							+ data.content.postco + "</td></tr>"
							+ "<tr><th>会员昵称</th>" + "<td>"
							+ data.content.bunick + "</td></tr>"
							+ "<tr><th>收货人名称</th>" + "<td>"
							+ data.content.recena + "</td></tr>"
							+ "<tr><th>移动电话</th>" + "<td>"
							+ data.content.mobile + "</td></tr>"
							+ "<tr><th>固定电话</th>" + "<td>"
							+ data.content.teleph + "</td></tr>"
							+ "<tr><th>来源店铺名</th>" + "<td>"
							+ data.content.shopna + "</td></tr>"
							+ "<tr><th>仓库编号</th>" + "<td>"
							+ data.content.whcode + "</td></tr>"
							+ "<tr><th>商家留言</th>" + "<td>"
							+ data.content.shmemo + "</td></tr>"
							+ "<tr><th>分拣批次号</th>" + "<td>"
							+ data.content.batchTaskCode + "</td></tr>"
							
							+ "<tr><th>分拣任务号</th>" + "<td>"
							+ data.content.backupTaskCode + "</td></tr>"
							
							+ "<tr><th>出库批次号</th>" + "<td>"
							+ data.content.batchCode + "</td></tr>";
					if ("single" == data.content.orderType) {
						tempString += "<tr><th>订单类型</th>" + "<td>单件</td></tr>";
					} else if ("multiple" == data.content.orderType) {
						tempString += "<tr><th>订单类型</th>" + "<td>多件</td></tr>";
					}
					$("#modalBodyOrders").html(tempString);
					//$("#" + ordeno).attr("href", "#ordersDetailed");
				} else if (data.status == "-1") {
					alert("还没有得到该订单的详细信息！");
				}
			},

			error : function() {
				alert("还没有得到该订单的详细信息！");
			}
		});
	}

/**
 * 获取订单信息
 * @param id
 */
function getAjaxReuse(id) {
		var tempString = "";
		$("#modalBodyOrders").html(tempString);
		$.ajax({
			type : 'post',
			url : path+'/ediOrderSource/reuse',
			data : 'id=' + id,
			dataType : 'json',
			success : function(data) {
					tempString += data.msg;
					
					$("#modalBodyOrders").html(tempString);
			},

			error : function() {
				alert("服务器异常，请重试");
			}
		});
	}


/**
 * 获取商品信息
 * @param id
 */
function getAjaxItems(id) {
	var tempString = "";
	$("#modalBodyItems").html(tempString);
	$
			.ajax({
				type : 'post',
				url : path+'/ediOrderSource/detailed',
				data : 'id=' + id,
				dataType : 'json',
				success : function(data) {
					if (data.status == "1") {
						tempString += "<tr><td>&nbsp;</td><th>SKU</th><th>数量</th><th>颜色</th><th>尺码</th><th>单价</th><th>优惠金额</th><th>应付金额</th><th>折扣</th><th>名称</th></tr>";
						$.each(data.content.skulst, function(i) {
							tempString += "<tr><th>商品" + (i + 1) + "</th>";
							tempString += "<td>" + data.content.skulst[i].sku + "</td>";
							tempString += "<td>" + data.content.skulst[i].qty + "</td>";
							tempString += "<td>" + data.content.skulst[i].col + "</td>";
							tempString += "<td>" + data.content.skulst[i].siz + "</td>";
							tempString += "<td>" + data.content.skulst[i].pri + "</td>";
							tempString += "<td>" + data.content.skulst[i].pro + "</td>";
							tempString += "<td>" + data.content.skulst[i].pay + "</td>";
							tempString += "<td>" + data.content.skulst[i].dis + "</td>";
							tempString += "<td>" + data.content.skulst[i].nam + "</td>";
							tempString += "</tr>";
						});

						$("#modalBodyItems").html(tempString);
						$("#" + id).attr("href", "#itemsDetailed");
					} else if (data.status == "-1") {
						alert("还没有得到该订单的详细信息！");
					}

				},

				error : function() {
					alert("还没有得到该订单的详细信息！");
				}
			});
}

//商家级联仓库
function ajaxAreaGroup(item,id) {
    $("#"+id).html('');
	var customerCode=item.value;
	if(customerCode==''){
	  return false;
	}
	$.ajax({
			type : 'post',
			url : path+'/areaGroup/ajaxAreaGroup',
			data : 'customerCode=' + customerCode,
			dataType : 'json',
			success : function(data) {
			  var tempString="";
			  tempString+="<option value=''>请选择...</option>";
				if (data.status == "1") {
					$.each(data.content,function(i){
					    tempString+="<option value="+data.content[i].groupCode+">"+data.content[i].groupName;
					});
				}else if (data.status == "2") {
					$.each(data.content.restAreaGroupDtos,function(i){
					    tempString+="<option value="+data.content.restAreaGroupDtos[i].areagroupCode+">"+data.content.restAreaGroupDtos[i].areagroupName;
					});
				} else {
					alert(data.content);
				}
                  $("#"+id).html(tempString);
			},
			error : function() {
				alert("获取信息错误！");
			}
		});
}